package com.shopping.runbackground.user.dao;

import com.shopping.runbackground.user.pojo.Jurisdictionc;
import com.shopping.runbackground.user.pojo.Jurisdictionf;
import com.shopping.runbackground.user.pojo.Sysadmin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface UserMapper extends Mapper<Sysadmin> {

    @Select("SELECT * FROM `jurisdictionf` WHERE jf_id IN(SELECT jf_id FROM `sysadmin_jurisdictionf` WHERE username=#{username})")
    List<Jurisdictionf> findJurisdictionfByusername(@Param("username") String username);

    @Select("SELECT * FROM `jurisdictionc` WHERE jc_id IN(SELECT jc_id FROM `sysadmin_jurisdiction` WHERE username=#{username})")
    List<Jurisdictionc> findJurisdictioncByusername(@Param("username") String username);

   /* @Insert("INSERT INTO sysadmin SET username=#{username},PASSWORD=#{password},NAME=#{name},job=#{job},state=#{state},j_id=#{j_id}")
    void addUser(Sysadmin sysadmin);*/

    @Insert("INSERT INTO sysadmin_jurisdictionf SET jf_id=#{jf_id},username=#{username}")
    void addsysadmin_jurisdictionf(@Param("jf_id") Integer jf_id,@Param("username") String username);

    @Insert("INSERT INTO sysadmin_jurisdiction SET jc_id=#{jc_id},username=#{username}")
    void addUser(@Param("jc_id") Integer jc_id,@Param("username") String username);
}
